package com.tadpole.music.adapter.question;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.question.UniversityBean;
import com.tadpole.music.holder.base.BaseViewHolder;
import com.tadpole.music.holder.question.HeadViewHolder;

import java.util.List;

/**
 * Created By 孙岩
 * on 2020/9/15
 */
public class HeadAdapter extends BaseAdapter {
    private Activity activity;
    private HeadViewHolder headViewHolder;
    private OnItemClickListener onItemClickListener;
    private List< UniversityBean.DataBean.CollegeFunctionsBean> list;

    public HeadAdapter(Activity activity,List< UniversityBean.DataBean.CollegeFunctionsBean> list){
        this.activity = activity;
        this.list = list;
    }


    @Override
    public BaseViewHolder createRelHolder(ViewGroup parent, int viewType) {
        headViewHolder = new HeadViewHolder(activity, LayoutInflater.from(activity).inflate(R.layout.layout_question_title, parent, false),list,onItemClickListener);
        return headViewHolder;
    }

    @Override
    public int getRelItemCount() {
        return list.size();
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {
        this.onItemClickListener = listener;
    }

    @Override
    public void setOnChildClickListener(OnChildClickListener listener) {

    }

    @Override
    public void setOnLongClickListener(OnLongClickListener listener) {

    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        holder.init(position - mHeadViews.size());
    }
}
